﻿using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using LTJ.Common;
using LTJ.Entity;
using LTJ.FrameWork;
using LTJ.Config;
using LTJ.Web.UI;
using System.Web.UI.DataVisualization.Charting;

namespace LTJ.WebPage.UserManage.system
{
    public partial class routehistory : UserPage
    {
        protected int rid = SASRequest.GetInt("rid", 0);
        protected string strwhere = "";

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindDataGrid();
            }
        }

        protected void BindDataGrid()
        {
            //Chart1.DataSource = OpLogs.GetRouteLogTable("");
            Chart1.ChartAreas["ChartArea1"].AxisX.Maximum = Convert.ToDateTime(System.DateTime.Now.ToString()).ToOADate();
            Chart1.ChartAreas["ChartArea1"].AxisX.Minimum = Convert.ToDateTime(System.DateTime.Now.AddMonths(-1).ToString()).ToOADate();
            Chart1.ChartAreas["ChartArea1"].AxisX.LabelStyle.Format = "yyyy MM dd";

            int i = 0;
            foreach (System.Data.DataRow dr in OpLogs.GetRouteLogTable(strwhere).Rows)
            {
                Chart1.Series["Series1"].Points.AddXY(Convert.ToDateTime(dr["createdate"].ToString()), dr["20GP"].ToString());
                Chart1.Series["Series1"].Points[i].ToolTip = dr["20GP"].ToString();
                Chart1.Series["Series2"].Points.AddXY(Convert.ToDateTime(dr["createdate"].ToString()), dr["40GP"].ToString());
                Chart1.Series["Series2"].Points[i].ToolTip = dr["40GP"].ToString();
                Chart1.Series["Series3"].Points.AddXY(Convert.ToDateTime(dr["createdate"].ToString()), dr["40HQ"].ToString());
                Chart1.Series["Series3"].Points[i].ToolTip = dr["40HQ"].ToString();
                i++;
            }

            //Chart1.DataBind();
        }

        #region Web 窗体设计器生成的代码

        override protected void OnInit(EventArgs e)
        {
            InitializeComponent();
            base.OnInit(e);
        }

        private void InitializeComponent()
        {
            strwhere = "rid = " + rid;
        }

        #endregion
    }
}